package Entity;

import java.awt.List;
import java.io.Serializable;
import java.util.ArrayList;

/** this class Create new Instance of product **/

public class Product implements Serializable {
	
	private static final long serialVersionUID = 42L;
	
	/**attributes for product*/
	private String ProductID;
	private String ProductName;
	private String Picture;
	private float Price;
	private String  Description;
	static String [] ProductsStringArr={""};
	static List products;
	public ArrayList<Product> productsList;
	
	/** Full constructor with all attributes **/	
	public Product(String ProductID,String ProductName, String Picture,float Price,String  Description) 
	{	
		setProductID(ProductID);
		setProductName(ProductName);
		setPicture(Picture);
		setPrice(Price);
		setDescription(Description);
		productsList = new ArrayList<Product>();
	}
	
	/**default constructor**/
	public Product()
	{
		
	}
	//
	/**function which calls the nest function*/
	public void Products()
	{
		createproductList();
	}
	
	/**function which creates product list*/
	private void createproductList() 
	{
		products = new List();
		products.add("choose customer");
	}
	
	/**function which adding product's details into customer's history*/
	public static void addCustomer(String product)
	{
		String tmp[] = new String[ProductsStringArr.length+1];
		for(int i=0;i<tmp.length-1;i++)
		{
			tmp[i]=new String(ProductsStringArr[i]);
		}
		tmp[tmp.length-1] = product;
		products.add(product);
	}
	
	/**set  attributes functions**/
	public void setProductID( String string) 
	{
		this.ProductID=string;
	}
	
	public void setProductName(String ProductName) 
	{
		this.ProductName = ProductName;
	}
	
	public void setPicture(String Picture) 
	{
		this.Picture = Picture;
	}
	
	public void setPrice(float Price) 
	{
		this.Price = Price;
	}
	
	public void setDescription(String  Description) 
	{
		this.Description = Description;
	}
	
	public static void setProducts(List products) 
	{
		Product.products = products;
	}
	
	public static void setProducts(String[] ProductsStringArr) 
	{
		Product.ProductsStringArr = ProductsStringArr;
		products =  new List();
		for(int i=0;i<ProductsStringArr.length;i++)
			products.add(ProductsStringArr[i]);
	}
	
	public void setCustomersList (List products) 
	{
		Product.products = products;
	}

	/** get attributes functions **/
	public static String[] getProductsStringArr() 
	{
		return ProductsStringArr;
	}
	
	public static List getProducts() 
	{
		return products;
	}
	
    public float getPrice() 
    {
		return this.Price;
	}
    
	public String getProductName() 
	{
		return this.ProductName;
	}
	
	public String getDescription() 
	{
		return this.Description;
	}
	
	public String getProductID() 
	{
		return this.ProductID;
	}
	
	public String  getPicture() 
	{
		return this.Picture;
	}
	
}
